home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group98a.txt
/
000150_icon-group-sender _Mon Mar 30 08:31:14 1998.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
4KB
Return-Path: <icon-group-sender>
Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
by baskerville.CS.Arizona.EDU (8.8.8/8.8.7) with SMTP id IAA25482
for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Mon, 30 Mar 1998 08:31:13 -0700 (MST)
Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
id AA29371; Mon, 30 Mar 1998 08:31:13 -0700
Message-Id: <199803281452.HAA29037@orpheus.gemini.edu>
From: swampler@noao.edu (Steve Wampler)
Date: Sat, 28 Mar 1998 07:52:39 MST
In-Reply-To: "William B. Clodius"'s mail message of Mar 27, 1:49pm.
X-Mailer: Mail User's Shell (7.2.3 5/22/91)
To: "William B. Clodius" <wclodius@lanl.gov>
Subject: Re: Icon and recursion
Cc: icon-group@optima.CS.Arizona.EDU
Errors-To: icon-group-errors@optima.CS.Arizona.EDU
Status: RO
Content-Length: 2994
On Mar 27 at 1:49pm, "William B. Clodius" writes:
} Hi:
}
} I have been trying to learn a little of Icon from information available
} over the net, and have been having trouble trying to transcribe some code
} from other languages to Icon. I have, so far, not had any problems
} translating procedural style code. The troublesome code has been primarilly
} Lisp or Lisp style benchmarks that rely heavily on recursion, i.e. the Tak
} benchmark and the change benchmark
} (http://www.webcom.com/nazgul/change.html). The Tak bencghmark appears to
} exhaust the internal stack before printing any output. Given the nature of
} the Tak benchmark I may not be able to do something to make it work. The
} Change benchmark, gives incorrect output and inserted write statements
} suggest an order of execution that I do not understand at all.
Odd, I've recursed very heavily in Icon (a lisp interpreter, recursive
descent parser, etc) with no problems. What machine/OS are you using?
(I use Unix/Linux exclusively, so you may be hitting a configuration
limit under some other OS.)
} As a result I have the following questions:
}
} 1. What are the semantics of Icon's argument passing mechanism, i.e., by
} value, by reference, copy-in/copy-out, no modifiable aliasing, by name,
} lazy, eager?
By value, but remember that Icon considers the 'value' of a structure
(list, table, set, record) to be its address.
} 2. What is the meaning of the "local" statement, i.e., does it ensure that
} a value is saved from call to call?
No, just that the reference won't conflict with any global variable of the
same name. "static" is a local variable that retains values across
calls. non-static local variables are created on procedure invocation
and destroyed on procedure return or failure. (Note that 'suspending'
from a procedure is neither a return or a failure, so local variables
retain values during a suspend-resume sequence.)
} 3. Can Icon handle recursion, and are there any tricks I should be aware of
} either to make recursion work or translate recursive code into a form Icon
} can handle? (Note Tak and Change are not tail recursive.)
Icon handles recursion just fine. I'd be interested in seeing the code
that is causing you problems.
} 4. Is there example code available which can give more insight into
} iterators and their semantics?
Probably, I assume you have the Icon book (3rd edition). There is
the "Icon Implementation" book (don't have the title handy right now,
which though dated in some of the implementation details, does explain
how generators,iterators, and GDE all work. I have tons of code that
use them heavily, but you'd need to spend some time examining the code
to get much insight (the code isn't written to illustrate generators
and goal-directed evaluation, but to use those features).
--
Steve Wampler - swampler@gemini.edu [Gemini 8m Telescopes Project (under AURA)]
The gods that smiled at your birth are now laughing openly. (Fortune Cookie)